package com.iflytek.yly.jetpackdemo.lifecycle;

import android.util.Log;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;

public class MyServiceObserver implements LifecycleObserver {

    private final String TAG = "MyServiceObserver";


    /**
     * 当Service的onCreate()方法被调用时，该方法会被自动调用
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    private void startGetLocation(){
        Log.e(TAG,"startGetLocation");
    }

    /**
     * 当Service的onDestroy方法被调用时，该方法会被自动调用
     */
    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    private void stopGetLocation(){
        Log.e(TAG,"stopGetLocation");
    }
}
